import Vue from 'vue'
import Router from 'vue-router'
// import HelloWorld from '@/components/HelloWorld'

Vue.use(Router)
const originalPush = Router.prototype.push;
Router.prototype.push = function push(location) {
    return originalPush.call(this, location).catch(err => err);
};

export default new Router({
    routes: [
        {
            path: '/',
            name: 'login',
            meta: {
                title: '登录',
                keepAlive: false
            },
            component: resolve => {
                require(['../views/login.vue'], resolve)
            },
        },
        {
            path: '/index',
            name: 'index',
            meta: {
                title: '首页',
                keepAlive: false //需要缓存
            },
            component: resolve => {
                require(['../views/index.vue'], resolve)
            },
            // redirect: to => {
            //   return '/login'
            // }
        },
        {
            path: '/discover',
            name: 'discover',
            meta: {
                title: '发现',
                keepAlive: false //需要缓存
            },
            component: resolve => {
                require(['../views/discover.vue'], resolve)
            },
        },
        {
            path: '/study',
            name: 'study',
            meta: {
                title: '学习',
                keepAlive: false //需要缓存
            },
            component: resolve => {
                require(['../views/study.vue'], resolve)
            },
        },
        {
            path: '/mine',
            name: 'mine',
            meta: {
                title: '我的',
                keepAlive: false //需要缓存
            },
            component: resolve => {
                require(['../views/mine.vue'], resolve)
            },
        },
        {
            path: '/liveList',
            name: 'liveList',
            meta: {
                title: '直播列表',
                keepAlive: false
            },
            component: resolve => {
                require(['../views/liveList.vue'], resolve)
            },
        },
        {
            path: '/liveUnderway',
            name: 'liveUnderway',
            meta: {
                title: '直播列表-进行中',
                keepAlive: false
            },
            component: resolve => {
                require(['../views/liveUnderway.vue'], resolve)
            },
        },
        {
            path: '/liveNoBroadcast',
            name: 'liveNoBroadcast',
            meta: {
                title: '直播列表-未开播',
                keepAlive: false
            },
            component: resolve => {
                require(['../views/liveNoBroadcast.vue'], resolve)
            },
        },
        {
            path: '/livePlayback',
            name: 'livePlayback',
            meta: {
                title: '直播列表-回放',
                keepAlive: false
            },
            component: resolve => {
                require(['../views/livePlayback.vue'], resolve)
            },
        },
        {
            path: '/liveStudio',
            name: 'liveStudio',
            meta: {
                title: '直播间',
                keepAlive: false
            },
            component: resolve => {
                require(['../views/liveStudio.vue'], resolve)
            },
        },
        {
            path: '/studying',
            name: 'studying',
            meta: {
                title: '学习中',
                keepAlive: false
            },
            component: resolve => {
                require(['../views/studying.vue'], resolve)
            },
        },
        {
            path: '/studied',
            name: 'studied',
            meta: {
                title: '已学习',
                keepAlive: false
            },
            component: resolve => {
                require(['../views/studied.vue'], resolve)
            },
        },
        {
            path: '/collect',
            name: 'collect',
            meta: {
                title: '收藏',
                keepAlive: false
            },
            component: resolve => {
                require(['../views/collect.vue'], resolve)
            },
        },
        {
            path: '/myOrder',
            name: 'myOrder',
            meta: {
                title: '我的订单',
                keepAlive: false
            },
            component: resolve => {
                require(['../views/myOrder.vue'], resolve)
            },
        },
        {
            path: '/orderInfo',
            name: 'orderInfo',
            meta: {
                title: '订单详情',
                keepAlive: false
            },
            component: resolve => {
                require(['../views/orderInfo.vue'], resolve)
            },
        },
        {
            path: '/myStudyCard',
            name: 'myStudyCard',
            meta: {
                title: '我的学习卡',
                keepAlive: false
            },
            component: resolve => {
                require(['../views/myStudyCard.vue'], resolve)
            },
        },
        {
            path: '/myStudyCardInfo',
            name: 'myStudyCardInfo',
            meta: {
                title: '学习卡详情',
                keepAlive: false
            },
            component: resolve => {
                require(['../views/myStudyCardInfo.vue'], resolve)
            },
        },
        {
            path: '/personalData',
            name: 'personalData',
            meta: {
                title: '个人资料',
                keepAlive: false
            },
            component: resolve => {
                require(['../views/personalData.vue'], resolve)
            },
        },
        {
            path: '/buyCourse',
            name: 'buyCourse',
            meta: {
                title: '购买课程',
                keepAlive: false
            },
            component: resolve => {
                require(['../views/buyCourse.vue'], resolve)
            },
        },
        {
            path: '/buySuccess',
            name: 'buySuccess',
            meta: {
                title: '购买成功',
                keepAlive: false
            },
            component: resolve => {
                require(['../views/buySuccess.vue'], resolve)
            },
        },
        {
            path: '/courseDetails-noBuy',
            name: 'courseDetails-noBuy',
            meta: {
                title: '课程详情-未购买',
                keepAlive: true
            },
            component: resolve => {
                require(['../views/courseDetails-noBuy.vue'], resolve)
            },
        },
        {
            path: '/courseDetails-buy',
            name: 'courseDetails-buy',
            meta: {
                title: '课程详情-已购买',
                keepAlive: false
            },
            component: resolve => {
                require(['../views/courseDetails-buy.vue'], resolve)
            }
        },
        {
            path: '/courseDetails-buy-live',
            name: 'courseDetails-buy-live',
            meta: {
                title: '直播课程详情-已购买',
                keepAlive: false
            },
            component: resolve => {
                require(['../views/courseDetails-buy-live.vue'], resolve)
            }
        },


        {
            path: '/courseDetails-buy',
            name: 'courseDetails-buy',
            meta: {
                title: '课程详情-已购买',
                keepAlive: false
            },
            component: resolve => {
                require(['../views/courseDetails-buy.vue'], resolve)
            }
        },
        {
            path: '/recommended-courses',
            name: 'recommended-courses',
            meta: {
                title: '课程详情-已购买',
                keepAlive: false
            },
            component: resolve => {
                require(['../views/recommended-courses.vue'], resolve)
            }
        },

        {
            path: '/informationList',
            name: 'informationList',
            meta: {
                title: '咨讯列表',
                keepAlive: false
            },
            component: resolve => {
                require(['../views/informationList.vue'], resolve)
            }
        },
        {
            path: '/informationInfo',
            name: 'informationInfo',
            meta: {
                title: '咨讯详情',
                keepAlive: false
            },
            component: resolve => {
                require(['../views/informationInfo.vue'], resolve)
            }
        },
        {
            path: '/hotGroup',
            name: 'hotGroup',
            meta: {
                title: '热门小组推荐',
                keepAlive: false
            },
            component: resolve => {
                require(['../views/hotGroup.vue'], resolve)
            }
        },
        {
            path: '/myJoinGroup',
            name: 'myJoinGroup',
            meta: {
                title: '我加入的小组',
                keepAlive: false
            },
            component: resolve => {
                require(['../views/myJoinGroup.vue'], resolve)
            }
        },
        {
            path: '/groupInfo',
            name: 'groupInfo',
            meta: {
                title: '小组详情',
                keepAlive: false
            },
            component: resolve => {
                require(['../views/groupInfo.vue'], resolve)
            }
        },
        {
            path: '/hotClass',
            name: 'hotClass',
            meta: {
                title: '热门班级推荐',
                keepAlive: false
            },
            component: resolve => {
                require(['../views/hotClass.vue'], resolve)
            }
        },
        {
            path: '/myJoinClass',
            name: 'myJoinClass',
            meta: {
                title: '我加入的班级',
                keepAlive: false
            },
            component: resolve => {
                require(['../views/myJoinClass.vue'], resolve)
            }
        },
        {
            path: '/hotTeacher',
            name: 'hotTeacher',
            meta: {
                title: '热门名师推荐',
                keepAlive: false
            },
            component: resolve => {
                require(['../views/hotTeacher.vue'], resolve)
            }
        },
        {
            path: '/attentionTeacher',
            name: 'attentionTeacher',
            meta: {
                title: '我关注的名师',
                keepAlive: false
            },
            component: resolve => {
                require(['../views/attentionTeacher.vue'], resolve)
            }
        },
        {
            path: '/myClass',
            name: 'myClass',
            meta: {
                title: '我的班级',
                keepAlive: false
            },
            component: resolve => {
                require(['../views/myClass.vue'], resolve)
            }
        },
        {
            path: '/setting',
            name: 'setting',
            meta: {
                title: '设置',
                keepAlive: false
            },
            component: resolve => {
                require(['../views/setting.vue'], resolve)
            }
        },
        {
            path: '/contactUs',
            name: 'contactUs',
            meta: {
                title: '联系我们',
                keepAlive: false
            },
            component: resolve => {
                require(['../views/contactUs.vue'], resolve)
            }
        },
        {
            path: '/aboutUs',
            name: 'aboutUs',
            meta: {
                title: '关于我们',
                keepAlive: false
            },
            component: resolve => {
                require(['../views/aboutUs.vue'], resolve)
            }
        },
        {
            path: '/user-agreement',
            name: 'user-agreement',
            meta: {
                title: '关于我们',
                keepAlive: false
            },
            component: resolve => {
                require(['../views/user-agreement.vue'], resolve)
            }
        },
        {
            path: '/studentDetails',
            name: 'studentDetails',
            meta: {
                title: '学员详情',
                keepAlive: false
            },
            component: resolve => {
                require(['../views/studentDetails.vue'], resolve)
            }
        },
        {
            path: '/service',
            name: 'service',
            meta: {
                title: '专属客服',
                keepAlive: false
            },
            component: resolve => {
                require(['../views/service.vue'], resolve)
            }
        },
        {
            path: '/invitationCode',
            name: 'invitationCode',
            meta: {
                title: '邀请码',
                keepAlive: false
            },
            component: resolve => {
                require(['../views/invitationCode.vue'], resolve)
            }
        },
        {
            path: '/invitationLog',
            name: 'invitationLog',
            meta: {
                title: '邀请记录',
                keepAlive: false
            },
            component: resolve => {
                require(['../views/invitationLog.vue'], resolve)
            }
        },
        {
            path: '/classify',
            name: 'classify',
            meta: {
                title: '分类',
                keepAlive: false
            },
            component: resolve => {
                require(['../views/classify.vue'], resolve)
            },
        },
        {
            path: '/classifyCourse',
            name: 'classifyCourse',
            meta: {
                title: '分类课程',
                keepAlive: false
            },
            component: resolve => {
                require(['../views/classifyCourse.vue'], resolve)
            },
        },
        {
            path: '/search',
            name: 'search',
            meta: {
                title: '搜索',
                keepAlive: false
            },
            component: resolve => {
                require(['../views/search.vue'], resolve)
            },
        },
        {
            path: '/searchCourse',
            name: 'searchCourse',
            meta: {
                title: '搜索课程',
                keepAlive: false
            },
            component: resolve => {
                require(['../views/searchCourse.vue'], resolve)
            },
        },
        {
            path: '/classCourse',
            name: 'classCourse',
            meta: {
                title: '搜索课程',
                keepAlive: false
            },
            component: resolve => {
                require(['../views/classCourse.vue'], resolve)
            },
        },
        {
            path: '/allStudent',
            name: 'allStudent',
            meta: {
                title: '全部学员',
                keepAlive: false
            },
            component: resolve => {
                require(['../views/allStudent.vue'], resolve)
            },
        },
        {
            path: '/noticeList',
            name: 'noticeList',
            meta: {
                title: '公告列表',
                keepAlive: false
            },
            component: resolve => {
                require(['../views/noticeList.vue'], resolve)
            },
        },
        {
            path: '/noticeDetails',
            name: 'noticeDetails',
            meta: {
                title: '公告详情',
                keepAlive: false
            },
            component: resolve => {
                require(['../views/noticeDetails.vue'], resolve)
            },
        },
        {
            path: '/exam',
            name: 'exam',
            meta: {
                title: '考试',
                keepAlive: false
            },
            component: resolve => {
                require(['../views/exam.vue'], resolve)
            },
        },
        {
            path: '/task',
            name: 'task',
            meta: {
                title: '作业',
                keepAlive: false
            },
            component: resolve => {
                require(['../views/task.vue'], resolve)
            },
        },
        {
            path: '/taskExplain',
            name: 'taskExplain',
            meta: {
                title: '作业详解',
                keepAlive: false
            },
            component: resolve => {
                require(['../views/taskExplain.vue'], resolve)
            },
        },
        {
            path: '/hotTopic',
            name: 'hotTopic',
            meta: {
                title: '热门话题',
                keepAlive: false
            },
            component: resolve => {
                require(['../views/hotTopic.vue'], resolve)
            },
        },
        {
            path: '/topicDetails',
            name: 'topicDetails',
            meta: {
                title: '话题详情',
                keepAlive: false
            },
            component: resolve => {
                require(['../views/topicDetails.vue'], resolve)
            },
        },
        {
            path: '/myCollect',
            name: 'myCollect',
            meta: {
                title: '我的收藏',
                keepAlive: false
            },
            component: resolve => {
                require(['../views/myCollect.vue'], resolve)
            },
        },
        {
            path: '/myCoupon',
            name: 'myCoupon',
            meta: {
                title: '我的优惠券',
                keepAlive: false
            },
            component: resolve => {
                require(['../views/myCoupon.vue'], resolve)
            },
        },
        {
            path: '/openMember',
            name: 'openMember',
            meta: {
                title: '开通会员',
                keepAlive: false
            },
            component: resolve => {
                require(['../views/openMember.vue'], resolve)
            },
        },
        {
            path: '/helpCenter',
            name: 'helpCenter',
            meta: {
                title: '帮助中心',
                keepAlive: false
            },
            component: resolve => {
                require(['../views/helpCenter.vue'], resolve)
            },
        },
        {
            path: '/feedback',
            name: 'feedback',
            meta: {
                title: '意见反馈',
                keepAlive: false
            },
            component: resolve => {
                require(['../views/feedback.vue'], resolve)
            },
        },
        {
            path: '/intelligenceService',
            name: 'intelligenceService',
            meta: {
                title: '智能客服',
                keepAlive: false
            },
            component: resolve => {
                require(['../views/intelligenceService.vue'], resolve)
            },
        },

        {
            path: '/signIn',
            name: 'signIn',
            meta: {
                title: '注册',
                keepAlive: true
            },
            component: resolve => {
                require(['../views/signIn.vue'], resolve)
            },
        },
        {
            path: '/passwordEdit',
            name: 'passwordEdit',
            meta: {
                title: '修改密码',
                keepAlive: false
            },
            component: resolve => {
                require(['../views/passwordEdit.vue'], resolve)
            }
        },
        {
            path: '/passwordForget',
            name: 'passwordForget',
            meta: {
                title: '忘记密码',
                keepAlive: false
            },
            component: resolve => {
                require(['../views/passwordForget.vue'], resolve)
            }
        },
    ]
})